import request from '@/utils/request'
import qs from 'qs'

export function login(data) {
  return request({
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    url: 'login/check',
    method: 'post',
    params: data
  })
}
// export function login(data) {
//   return request({
//     url: '/vue-admin-template/user/login',
//     method: 'post',
//     data
//   })
// }
export function getInfo() {
  return request({
    url: 'login/getInfo',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: 'logout',
    method: 'post'
  })
}
export function changePassword(data) {
  return request({
    url: 'user/changePassword',
    method: 'post',
    data: data,
    transformRequest: [function(data) {
      return qs.stringify(data)
    }],
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}
// 根据用户姓名获取用户列表
export function getUserListByUserName(data) {
  return request({
    url: '/user/getUserListByUserName',
    method: 'post',
    data: data,
    transformRequest: [function(data) {
      return qs.stringify(data)
    }]
  })
}
